home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / code1a / form1.frm < prev    next >
Text File  |  1999-10-14  |  10KB  |  376 lines

  1. VERSION 5.00
  2. Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
  3. Begin VB.Form Form1 
  4.    BorderStyle     =   3  'Fixed Dialog
  5.    Caption         =   "Code"
  6.    ClientHeight    =   4965
  7.    ClientLeft      =   45
  8.    ClientTop       =   330
  9.    ClientWidth     =   6660
  10.    Icon            =   "Form1.frx":0000
  11.    LinkTopic       =   "Form1"
  12.    MaxButton       =   0   'False
  13.    MinButton       =   0   'False
  14.    ScaleHeight     =   4965
  15.    ScaleWidth      =   6660
  16.    ShowInTaskbar   =   0   'False
  17.    StartUpPosition =   2  'CenterScreen
  18.    Begin VB.CommandButton Command4 
  19.       Caption         =   "Open"
  20.       Height          =   375
  21.       Left            =   120
  22.       TabIndex        =   8
  23.       Top             =   4440
  24.       Width           =   1455
  25.    End
  26.    Begin MSComctlLib.ImageList ImageList1 
  27.       Left            =   4080
  28.       Top             =   1080
  29.       _ExtentX        =   1005
  30.       _ExtentY        =   1005
  31.       BackColor       =   -2147483643
  32.       ImageWidth      =   32
  33.       ImageHeight     =   32
  34.       MaskColor       =   12632256
  35.       _Version        =   393216
  36.       BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  37.          NumListImages   =   3
  38.          BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  39.             Picture         =   "Form1.frx":0FC2
  40.             Key             =   "direktorijum"
  41.          EndProperty
  42.          BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  43.             Picture         =   "Form1.frx":2786
  44.             Key             =   "kljuc"
  45.          EndProperty
  46.          BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  47.             Picture         =   "Form1.frx":375A
  48.             Key             =   "tekst"
  49.          EndProperty
  50.       EndProperty
  51.    End
  52.    Begin VB.DirListBox Dir1 
  53.       Height          =   3690
  54.       Left            =   120
  55.       TabIndex        =   6
  56.       Top             =   600
  57.       Width           =   2295
  58.    End
  59.    Begin VB.FileListBox File1 
  60.       Height          =   675
  61.       Left            =   5400
  62.       Pattern         =   "*.cod;*.txt"
  63.       TabIndex        =   5
  64.       Top             =   0
  65.       Visible         =   0   'False
  66.       Width           =   975
  67.    End
  68.    Begin VB.CommandButton Command3 
  69.       Caption         =   "Code"
  70.       Height          =   375
  71.       Left            =   1680
  72.       TabIndex        =   4
  73.       Top             =   4440
  74.       Width           =   1455
  75.    End
  76.    Begin VB.CommandButton Command2 
  77.       Caption         =   "Decode"
  78.       Height          =   375
  79.       Left            =   3240
  80.       TabIndex        =   3
  81.       Top             =   4440
  82.       Width           =   1455
  83.    End
  84.    Begin VB.CommandButton Command1 
  85.       Caption         =   "Exit"
  86.       Height          =   375
  87.       Left            =   4800
  88.       TabIndex        =   2
  89.       Top             =   4440
  90.       Width           =   1695
  91.    End
  92.    Begin MSComctlLib.ListView ListView1 
  93.       Height          =   3615
  94.       Left            =   2520
  95.       TabIndex        =   1
  96.       Top             =   720
  97.       Width           =   4095
  98.       _ExtentX        =   7223
  99.       _ExtentY        =   6376
  100.       Arrange         =   1
  101.       LabelEdit       =   1
  102.       SortOrder       =   -1  'True
  103.       Sorted          =   -1  'True
  104.       LabelWrap       =   -1  'True
  105.       HideSelection   =   0   'False
  106.       HotTracking     =   -1  'True
  107.       HoverSelection  =   -1  'True
  108.       PictureAlignment=   5
  109.       _Version        =   393217
  110.       Icons           =   "ImageList1"
  111.       SmallIcons      =   "ImageList1"
  112.       ColHdrIcons     =   "ImageList1"
  113.       ForeColor       =   -2147483640
  114.       BackColor       =   -2147483643
  115.       BorderStyle     =   1
  116.       Appearance      =   1
  117.       NumItems        =   0
  118.    End
  119.    Begin VB.DriveListBox Drive1 
  120.       Height          =   315
  121.       Left            =   120
  122.       TabIndex        =   0
  123.       Top             =   120
  124.       Width           =   2895
  125.    End
  126.    Begin VB.Label Label2 
  127.       AutoSize        =   -1  'True
  128.       Caption         =   "Selected:"
  129.       Height          =   195
  130.       Left            =   3120
  131.       TabIndex        =   9
  132.       Top             =   240
  133.       Width           =   675
  134.    End
  135.    Begin VB.Label Label1 
  136.       AutoSize        =   -1  'True
  137.       BackStyle       =   0  'Transparent
  138.       Caption         =   "Label1"
  139.       BeginProperty Font 
  140.          Name            =   "MS Sans Serif"
  141.          Size            =   8.25
  142.          Charset         =   0
  143.          Weight          =   700
  144.          Underline       =   0   'False
  145.          Italic          =   0   'False
  146.          Strikethrough   =   0   'False
  147.       EndProperty
  148.       ForeColor       =   &H00FFFF00&
  149.       Height          =   195
  150.       Left            =   3960
  151.       TabIndex        =   7
  152.       Top             =   240
  153.       Width           =   585
  154.    End
  155. End
  156. Attribute VB_Name = "Form1"
  157. Attribute VB_GlobalNameSpace = False
  158. Attribute VB_Creatable = False
  159. Attribute VB_PredeclaredId = True
  160. Attribute VB_Exposed = False
  161.  
  162.  
  163.  
  164. '                    Code and decode TextFiles
  165.  
  166. '     Pretty good way to code text file;
  167. '     Code and Decode using password
  168. '     How to use some common controlls (FileListBox,
  169. '     Image list, ListView, DirLisBox, FileListBox...
  170. '     Very clean encrypting (no trash left)
  171. '                 sslavko@yubc.net
  172. '     _______________________________________________
  173.  
  174.  
  175.  
  176.  
  177.  
  178. Public Sub osvezi() 'Refresh
  179. ListView1.ListItems.Clear
  180.  
  181. 'For i = 0 To Dir1.ListCount - 1
  182. 'ListView1.ListItems.Add , "dir" + Right$(Str$(i), Len(Str$(i))), Right$(Dir1.List(i), Len(Dir1.List(i)) - Len(Dir1.Path)), ImageList1.ListImages.Item(1).Key, ImageList1.ListImages.Item(1).Key
  183. 'Next i
  184. Label1.Caption = Dir1.Path
  185.  
  186. File1.Path = Dir1.Path
  187. For i = 0 To File1.ListCount - 1
  188. If Right$(File1.List(i), 3) = "cod" Then
  189. ListView1.ListItems.Add , "file" + Right$(Str$(i), Len(Str$(i))), File1.List(i), ImageList1.ListImages.Item(2).Key, ImageList1.ListImages.Item(2).Key
  190. Else
  191. ListView1.ListItems.Add , "file" + Right$(Str$(i), Len(Str$(i))), File1.List(i), ImageList1.ListImages.Item(3).Key, ImageList1.ListImages.Item(3).Key
  192. End If
  193. Next i
  194. ListView1.Refresh
  195. End Sub
  196.  
  197.  
  198. Private Sub Command1_Click()
  199. End
  200. End Sub
  201.  
  202.  
  203. Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  204. Command1.SetFocus
  205. End Sub
  206.  
  207.  
  208. Private Sub Command2_Click()
  209. Dim slovo(1 To 80) As String
  210.  
  211. 'Set password
  212. s$ = InputBox$("Password:", "Enter Password")
  213. If s$ = "" Then
  214. Beep
  215. MsgBox "Password required!", , "Error"
  216. Exit Sub
  217. End If
  218.  
  219. 'processing password
  220. For i = 1 To Len(s$)
  221.  slovo(i) = Mid$(s$, i, 1)
  222. Next i
  223. k = 1
  224. Max = i
  225.  
  226. 'Read, encrypt, write
  227. If Label1.Caption = "" Then
  228. Beep
  229. MsgBox$ "Select File.", , "Error"
  230. Exit Sub
  231. End If
  232.  
  233. If Right$(Dir1.Path, 1) = "\" Then otvori$ = Dir1.Path Else otvori$ = Dir1.Path + "\"
  234. Open otvori$ + Label1.Caption For Input As 1
  235. Open otvori$ + "dekode.txt" For Output As 2
  236. Do Until EOF(1)
  237. Line Input #1, a$
  238. 'ENGINE
  239. b$ = ""
  240. posl = 1
  241. For i = 1 To Len(a$) Step 4
  242. d% = Val(Mid$(a$, i, 4)) - Asc(slovo(k))
  243. If d% = 0 Or d% > 255 Then Exit For
  244. b$ = b$ + Chr$(d%)
  245. k = k + 1
  246. If k > (Max - 1) Then k = 1
  247. Next i
  248. Print #2, b$
  249. Loop
  250. Close #1
  251. Close #2
  252. ListView1.ListItems.Add , "file" + Label1.Caption, "dekode.txt", ImageList1.ListImages.Item(3).Key, ImageList1.ListImages.Item(3).Key
  253. End Sub
  254.  
  255. Private Sub Command2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  256. Command2.SetFocus
  257. End Sub
  258.  
  259.  
  260. Private Sub Command3_Click()
  261. Dim slovo(1 To 80) As String
  262. Dim a As String * 80
  263.  
  264.  
  265. s$ = InputBox$("Password:", "Enter")
  266. If s$ = "" Then
  267. Beep
  268. MsgBox "Enter password", , "Error"
  269. Exit Sub
  270. End If
  271.  
  272.  
  273. For i = 1 To Len(s$)
  274.  slovo(i) = Mid$(s$, i, 1)
  275. Next i
  276. k = 1
  277. Max = i
  278.  
  279. If Label1.Caption = "" Then
  280. Beep
  281. MsgBox "Select File.", vbOKOnly, "Error"
  282. Exit Sub
  283. End If
  284.  
  285.  
  286.  
  287. If Right$(Dir1.Path, 1) = "\" Then otvori$ = Dir1.Path + Label1.Caption Else otvori$ = Dir1.Path + "\" + Labe